package com.example.book.enums;

public enum Status {
    DELETE(0, "删除"),
    NORMAL(1, "可借阅"),
    IMPROPER(2, "不可借阅"),
    ;

    Status(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private Integer code;
    private String desc;

    public static String getDescByCode(Integer code) {
        switch (code) {
            case 0: return DELETE.getDesc();
            case 1: return NORMAL.getDesc();
            default: return IMPROPER.getDesc();
        }
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
